package controller;

import dao.ArticleDao;


import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet("/people/like")
public class PeopleLikeServlet extends HttpServlet {
    ArticleDao articleDao = new ArticleDao() ;
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        String id = request.getParameter("id") ;

        int total = articleDao.peopleLike(id);
        if (total > 0) {
            response.sendRedirect("/main");
        } else {
            request.getRequestDispatcher("/error.jsp").forward(request, response);
        }

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
